import requests

ip = 'http://192.168.184.139'

loginData={"username":"ytc123456","password":"123456","act":"act_login","back_act":"http://192.168.184.139/","submit":""}

r=requests.post(f"{ip}/user.php",data=loginData)

print(r)
#获取cookice
cookice = r.cookies

#新增留言
getLogData = {"msg_type":"0","msg_title":"123456789","msg_content":"987654321","act":"act_add_message"}

fname = r'C:\python\2504\apiTest\datas\123.jpg'
fData2={'message_img':('123.jpg',open(fname,'rb'),'image/png')}

r2 =requests.post(f'{ip}/user.php',data=getLogData,files=fData2,cookies=cookice)


print(r2)
print(r2.text)

#上传文件
